package com.android.aishangauction.adapt;

import android.graphics.Color;

import com.android.aishangauction.model.member.CouponListData;
import com.android.aishangauction.utils.ObjectUtils;
import com.android.aishangauction.R;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;


public class listMineCouponAdapt extends BaseQuickAdapter<CouponListData.Mineyouhuiquandata, BaseViewHolder> {
    private String i;

    public listMineCouponAdapt(int layoutResId, List<CouponListData.Mineyouhuiquandata> data, String i) {
        super(layoutResId, data);
        this.i = i;

    }

    @Override
    protected void convert(BaseViewHolder helper, CouponListData.Mineyouhuiquandata mineyouhuiquandata) {
        String start = ObjectUtils.getStrTime(mineyouhuiquandata.getB_start_time(), "yyyy-MM-dd");
        String end = ObjectUtils.getStrTime(mineyouhuiquandata.getB_end_time(), "yyyy-MM-dd");
        if (mineyouhuiquandata.getB_end_time().equals("0")) {
            helper.setText(R.id.item_list_mine_youhuiquan_tv3, "有效期不限");

        } else {
            helper.setText(R.id.item_list_mine_youhuiquan_tv3, start + "--" + end);

        }
        helper.setText(R.id.item_list_mine_youhuiquan_tv1, mineyouhuiquandata.getB_title());
        helper.setText(R.id.item_list_mine_youhuiquan_img, "￥" + mineyouhuiquandata.getB_amount());
        switch (i) {
            case "1":
                //未使用
                helper.setBackgroundRes(R.id.ll_noused, R.mipmap.mine_youhuiquan_bg);
                helper.setTextColor(R.id.item_list_mine_youhuiquan_tv1, Color.parseColor("#fca242"));
                helper.setTextColor(R.id.item_list_mine_youhuiquan_tv2, Color.parseColor("#333333"));
                helper.setTextColor(R.id.item_list_mine_youhuiquan_tv3, Color.parseColor("#333333"));
                helper.setTextColor(R.id.item_list_mine_youhuiquan_img, Color.parseColor("#fca242"));
                helper.setTextColor(R.id.dianpuquan, Color.parseColor("#fca242"));


                break;
            case "2|3":
                //已使用或者已过期


                helper.setBackgroundRes(R.id.ll_noused, R.mipmap.mine_youhuiquan_bg_used);
                helper.setTextColor(R.id.item_list_mine_youhuiquan_tv1, Color.parseColor("#5A5A5A"));
                helper.setTextColor(R.id.item_list_mine_youhuiquan_tv2, Color.parseColor("#5A5A5A"));
                helper.setTextColor(R.id.item_list_mine_youhuiquan_tv3, Color.parseColor("#5A5A5A"));
                helper.setTextColor(R.id.item_list_mine_youhuiquan_img, Color.parseColor("#5A5A5A"));
                helper.setTextColor(R.id.dianpuquan, Color.parseColor("#5A5A5A"));
                break;


        }
    }


}
